package com.shigen.demo.entity;

import com.baomidou.mybatisplus.annotation.Version;
import com.shigen.demo.annation.valid.ListValue;
import com.shigen.demo.valid.AddGroup;
import com.shigen.demo.valid.UpdateGroup;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户账户密码实体
 *
 * @author shigenfu
 */
@Data
@Accessors(chain = true)
public class User implements Serializable {

    /**
     * 自增的id
     */
    @Null(message = "新增时不能指定id", groups = {AddGroup.class})
    @NotNull(message = "修改时必须指定id", groups = {UpdateGroup.class})
    private Long id;
    /**
     * 用户名
     */
    @NotBlank(message = "用户名必须提交", groups = {AddGroup.class, UpdateGroup.class})
    private String username;
    /**
     * 用户密码
     */
    private String password;
    /**
     * 昵称
     */
    private String nickname;
    /**
     * 电话
     */
    private String phone;
    /**
     * 自我介绍
     */
    private String introduction;
    /**
     * 是否删除
     */
    @ListValue(values = {0, 1}, groups = AddGroup.class)
    private Integer status;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    @Version
    private Date updateTime;

}

